package com.yohann.boot.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.yohann.boot.common.annotation.ConvertEnum;
import com.yohann.boot.common.annotation.EnableConvert;
import com.yohann.boot.common.annotation.EnumValid;
import com.yohann.boot.common.enums.TestEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;

/**
 * 测试实体
 *
 * @author Yeung Wah
 * @since 2021/5/7
 */
@Data
@ApiModel(value = "测试实体")
@EnableConvert
public class TestEntity {
    @TableId
    private Integer id;
    @ApiModelProperty(value = "姓名")
    @NotBlank(message = "名字不能为空")
    @ConvertEnum(clazz = TestEnum.class, codeField = "age")
    private String name;
    @ApiModelProperty(value = "年龄")
    @EnumValid(clazz = TestEnum.class)
    private Integer age;
}